<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>1</title>
        <style>
            button {
                height: 25px;
                background: deepskyblue;
                border: none;
                border-radius: 5px;
                color: white;
                cursor: pointer;
                margin-left: 600px;
                margin-top: 200px;
            }
            .btn{
                background: darkgray;
                cursor: default;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <button v-if="disabled" @click="send">发送</button>
            <button v-if="!disabled" class="btn">({{num}})发送</button>
        </div>
        <script src="../js/vue.js"></script>
        <script>
            var app = new Vue({
                el: "#app",
                data: {
                    disabled: true,
                    num: 10
                },
                methods: {
                    send() {
                        this.disabled = false;
                        let _this = this
                        let timer = setInterval(function (){
                            _this.num--;
                            if (_this.num===0){
                                clearInterval(timer);
                                _this.disabled = true;
                                _this.num = 10;
                            }
                        },1000)
                    }
                }
            })
        </script>
    </body>
</html>